package com.tian.concurrent;

import java.util.concurrent.atomic.AtomicInteger;

public class AutomicIntegerTest {
	private static AtomicInteger counter = new AtomicInteger();
	
	public static int getNextId(){
		return counter.incrementAndGet();
	}
	
	
	
	
	
	
	
	
	
	
	public static void main(String[] args) {
		long startTime = System.currentTimeMillis();
		for(int i = 0;i < 100000000;i++){
			//System.out.println(getNextId());
			getNextId();
		}
		System.out.println(getNextId());
		System.out.println((System.currentTimeMillis()-startTime)+"ms");
	}
	
}
